import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.Path;
import org.apache.hadoop.io.IntWritable;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapreduce.Job;
import org.apache.hadoop.mapreduce.lib.input.FileInputFormat;
import org.apache.hadoop.mapreduce.lib.output.FileOutputFormat;

import java.io.IOException;

public class FriendDriver  {
    public static void main(String[] args) throws IOException, ClassNotFoundException, InterruptedException {

        Configuration conf = new Configuration();

        Job job = Job.getInstance(conf);

        job.setJarByClass(FriendDriver.class);

        job.setMapperClass(FriendsMap.class);
        job.setReducerClass(FriendReduce.class);


        job.setMapOutputKeyClass(Text.class);
        job.setMapOutputValueClass(Text.class);

        job.setOutputKeyClass(Text.class);
        job.setOutputValueClass(Text.class);


//        FileInputFormat.setInputPaths(job,"D:\\Filework\\input3");
//        FileOutputFormat.setOutputPath(job,new Path("D:\\Filework\\output3"));
        FileInputFormat.setInputPaths(job,"/wordcount/input3");
        FileOutputFormat.setOutputPath(job,new Path("/wordcount/output3"));
        boolean b = job.waitForCompletion(true);
        System.exit(b?0:1);
    }
}
